home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Adobe Graphics & Publishing SDK 1996 December
/
Adobe Graphics & Publishing SDK 1996 December.iso
/
pc
/
pm65sdk
/
sourcecode
/
c_language
/
frame
/
common
/
main.cpp
Wrap
C/C++ Source or Header
|
1996-07-16
|
7KB
|
293 lines
/*
*--- main.cpp ----------------------------------------------------------
* Copyright (c) 1992-96 Adobe Systems, Inc. All rights reserved.
*
* PageMaker plug-in OpenCopy.
*-----------------------------------------------------------------------
*/
/* ---------------- PageMaker SDK include files ---------------- */
#include "PMPlugin.h"
/* ---------------- Plug-in include files ---------------- */
#ifdef MACINTOSH
#include "WinTypes.h"
#endif // MACINTOSH
/* ---------------- Cross-platform include files ---------------- */
#include <string.h>
#include <stdio.h>
/* ---------------- Platform specific include files ---------------- */
#ifdef MACINTOSH
#include <types.h>
#ifndef powerc
#include <A4Stuff.h>
#include <SetUpA4.h>
#endif
#else
#include <windows.h>
#endif
/* ---------------- Type definitions ---------------- */
/* ---------------- Definitions ---------------- */
#define SUCCESS 1
#define FAILURE 0
#define STAYINMEMORY -1
/* ---------------- PageMaker (New)SDK include files ---------------- */
#include "CIInterfaceManager.h"
#include "PMEvent.h"
#include "PMEventRec.h"
#include "CIBasic.h"
#include "PMInterfaceIDs.h"
#include "CICommandsAndQueries.h"
/* ---------------- Function declarations ---------------- */
PMXErr DoInvoke( PMMessage *pMsg );
PMXErr DoLoad(PMMessage* pMsg);
PMXErr DoRegister(PMMessage* pMsg);
PMXErr DoInvoke(PMMessage* pMsg);
PMXErr DoEvent(PMMessage* pMsg);
PMXErr DoSysEvent(PMMessage* pMsg);
PMXErr DoAcquireInterface(PMMessage* pMsg);
PMXErr DoReleaseInterface( PMMessage *pMsg );
PMXErr DoUnload(PMMessage* pMsg);
PMXErr DoShutdown(PMMessage* pMsg);
PMXErr DoCleanup(PMMessage* pMsg);
#ifdef MACINTOSH
#ifdef powerc
#pragma export on
#endif
PMXErr main(PMMessage *pMsg);
#ifdef powerc
#pragma export off
#endif
#else
BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID pReserved);
#endif
/* ---------------- Globals ---------------- */
sPMParamBlockPtr thePB = NULL;
CIInterfaceManager *gpIntfMgr = (CIInterfaceManager *) NULL;
#ifdef WINDOWS
HINSTANCE ghDLL;
BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID pReserved)
{
ghDLL = hDLL;
return TRUE;
}
#endif
/*
*--- main --------------------------------------------------------------------
* Entry point for plug-in control tasks.
*-----------------------------------------------------------------------------
*/
PMXErr main(PMMessage *pMsg)
{
PMXErr result;
#if __MWERKS__ && __MC68K__
long oldA4 = SetCurrentA4();
RememberA4();
#endif
gpIntfMgr = pMsg->pInterfaceMgr;
switch ( pMsg->opCode ) {
case kPMLoad:
result = DoLoad(pMsg);
break;
case kPMRegister:
result = DoRegister(pMsg);
break;
case kPMInvoke:
result = DoInvoke(pMsg);
break;
case kPMEvent:
result = DoEvent(pMsg);
break;
case kPMSysEvent:
result = DoSysEvent(pMsg);
break;
case kPMAcquireInterface:
result = DoAcquireInterface(pMsg);
break;
case kPMReleaseInterface:
result = DoReleaseInterface(pMsg);
break;
case kPMUnload:
result = DoUnload(pMsg);
break;
case kPMShutdown:
result = DoShutdown(pMsg);
break;
case kPMCleanup:
result = DoCleanup(pMsg);
break;
default:
result = 0;
}
#if __MWERKS__ && __MC68K__
SetA4(oldA4);
#endif
return result;
}
/*
*--- DoRegister --------------------------------------------------------------
* Called if Plug-in registers for Events or adds new interfaces to PM.
*-----------------------------------------------------------------------------
*/
PMXErr DoRegister( PMMessage *pMsg )
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoAcquireInterface ------------------------------------------------------
* Called when other plug-ins acquire the exported interface.
*-----------------------------------------------------------------------------
*/
PMXErr DoAcquireInterface( PMMessage *pMsg )
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoReleaseInterface ------------------------------------------------------
* Called when other plug-ins release the acquired interface.
*-----------------------------------------------------------------------------
*/
PMXErr DoReleaseInterface( PMMessage *pMsg )
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoInvoke ----------------------------------------------------------------
*
*-----------------------------------------------------------------------------
*/
PMXErr DoInvoke( PMMessage *pMsg )
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoLoad ------------------------------------------------------------------
*
*-----------------------------------------------------------------------------
*/
PMXErr DoLoad(PMMessage* pMsg)
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoEvent -----------------------------------------------------------------
*
*-----------------------------------------------------------------------------
*/
PMXErr DoEvent(PMMessage* pMsg)
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoSysEvent --------------------------------------------------------------
*
*-----------------------------------------------------------------------------
*/
PMXErr DoSysEvent(PMMessage* pMsg)
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoUnload ----------------------------------------------------------------
*
*-----------------------------------------------------------------------------
*/
PMXErr DoUnload(PMMessage* pMsg)
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoShutdown --------------------------------------------------------------
*
*-----------------------------------------------------------------------------
*/
PMXErr DoShutdown(PMMessage* pMsg)
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}
/*
*--- DoCleanup ---------------------------------------------------------------
*
*-----------------------------------------------------------------------------
*/
PMXErr DoCleanup(PMMessage* pMsg)
{
PMXErr result = SUCCESS;
gpIntfMgr = pMsg->pInterfaceMgr;
return result;
}